/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.PA165.musiclibrarybackend.services;

import cz.muni.fi.PA165.musiclibraryapi.dto.UserDTOInterface;
import cz.muni.fi.PA165.musiclibraryapi.services.UserService;
import cz.muni.fi.PA165.musiclibrarybackend.dao.UserDAO;
import cz.muni.fi.PA165.musiclibrarybackend.transfers.UserT;
import java.io.Serializable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class UserServiceImpl implements UserService, Serializable{
    
    private UserDAO userDAO;
    
    public void setUserDAO(UserDAO userDAO) {
        this.userDAO = userDAO;
    }
    
    public void createUser(UserDTOInterface user) {
        userDAO.createUser(UserT.DTOtoUser(user));
    }

    public UserDTOInterface getUser(String name) {
        return UserT.UserToDTO(userDAO.getUser(name));
    }
    
}
